package site.teamo.biu.net.server.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import site.teamo.biu.net.common.web.mapper.SystemConfigMapper;
import site.teamo.biu.net.server.configuration.ServerConfiguration;
import site.teamo.biu.tool.core.model.BiuJSONResult;
import site.teamo.biu.tool.core.util.BiuJSONResultUtils;

/**
 * @author haocongshun
 * @date 2023/06/30 17:06:10
 */
@Tag(name = "服务配置")
@RestController
@RequestMapping("/api/config")
public class ConfigController {

    @Resource
    private SystemConfigMapper systemConfigMapper;

    @PostMapping("/base")
    public BiuJSONResult<Boolean> base(@RequestBody String serverName) {
        ServerConfiguration.SERVER_NAME.setContent(systemConfigMapper, serverName);
        return BiuJSONResultUtils.ok(true);
    }

}
